﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using Manager.App_Code.DTO;

namespace Manager.App_Code.REPORTS
{
    public partial class RP_HoaDonTraPhong_ChiTiet : DevExpress.XtraReports.UI.XtraReport
    {
        public RP_HoaDonTraPhong_ChiTiet()
        {
            InitializeComponent();
        }

           string _GuestName, _RoomID, _Arivaldate, _DepatureDate, _DateNumber, _Price;
     

        public RP_HoaDonTraPhong_ChiTiet(HoaDonTraPhongDTO hoadondto)
        {
            InitializeComponent();

            _GuestName = hoadondto.MaPhieuDat.MaKhachHang.TenKH;
            _RoomID = hoadondto.MaPhong.TenPhong;
            _Arivaldate = hoadondto.MaPhieuDat.NgayDen.ToShortDateString();
            _DepatureDate = hoadondto.NgayTra.ToShortDateString();
            _DateNumber = (hoadondto.NgayTra.Day - hoadondto.MaPhieuDat.NgayDen.Day).ToString();
            _Price = hoadondto.MaPhieuDat.MaPhong.LoaiPhong.GiaPhong.ToString();
        }

        
        public void BindData()
        {

            CellDecription.DataBindings.Add("Text", DataSource, "MaDV.TenDichVu");
            CellQty.DataBindings.Add("Text", DataSource, "SoLuong");

            CellPrice.DataBindings.Add("Text", DataSource, "MaDV.GiaDV");

            CellDiscount.DataBindings.Add("Text", DataSource, "GiamPT");

            CellSubTotal.DataBindings.Add("Text", DataSource, "SoTien");

            CellCurrency.Text= "VND";
            
        }



     



        private void ReportHeader_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            labelGuestName.Text = _GuestName;
            labelRoomID.Text = _RoomID;
            labelArrivaldate.Text = _Arivaldate;
            labelDepatureDate.Text = _DepatureDate;

            labelDateNumber.Text = _DateNumber;
            labelPrice.Text = _Price;
        }


        int stt = 0;
     
        private void cellSTT_BeforePrint_1(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            stt++;
            cellSTT.Text = stt.ToString();
        }

    }
}
